What are the semantics of [myThing.myProperty release]?
Posted
by dugla
on Stack Overflow
See other posts from Stack Overflow
or by dugla
Published on 2010-05-28T01:56:37Z
Indexed on
2010/05/28
2:01 UTC
Read the original article
Hit count: 229
I clearly have not fully grocked properties. I have an instance of a class, myThing. myThing has a property that has be synthesized:
// .h
@property(nonatomic,retain)MyCoolType *coolType;
// .m
@synthesize coolType;
In my program I call:
// The retain count on MyCoolType is 1.
[myThing.coolType release];
The reference count on MyCoolType is now zero and dealloc should fire.
So, shouldn't myThing.coolType now be nil? In my code that is not the case. How do a correctly release and force the property to return nil?
Thanks,
Doug
© Stack Overflow or respective owner